home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / Scrap.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  7KB  |  191 lines

  1. /*
  2.      File:        Scrap.h
  3.  
  4.      Contains:    Scrap Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __SCRAP__
  19. #define __SCRAP__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __FILEMANAGER__
  25. #include <FileManager.h>
  26. #endif
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32. #if PRAGMA_IMPORT_SUPPORTED
  33. #pragma import on
  34. #endif
  35.  
  36. #if PRAGMA_ALIGN_SUPPORTED
  37. #pragma options align=mac68k
  38. #endif
  39.  
  40. /*
  41. _________________________________________________________________________________________________________
  42.  * STUCTURES
  43. _________________________________________________________________________________________________________
  44. */
  45. typedef struct OpaqueScrapRef* ScrapRef;
  46. typedef UInt32 ScrapItemUserReference;
  47. typedef OSType ScrapItemType;
  48. #if FOR_SYSTEM8_PREEMPTIVE
  49. /*
  50. _________________________________________________________________________________________________________
  51.  * SCRAP ITEM TYPE ATTRIBUTES
  52. _________________________________________________________________________________________________________
  53. */
  54. typedef OptionBits ScrapItemTypeAttributes;
  55.  
  56. enum {
  57.     kScrapItemTypeNoAttributes    = (0 << 0),                        /* No scrap item type attributes*/
  58.     kScrapItemTypeSenderOnly    = (1 << 0),                        /* Scrap item type is available to sender only*/
  59.     kScrapItemTypeSenderTranslated = (1 << 1),                    /* Scrap item type is translated by sender*/
  60.     kScrapItemTypeNotSaved        = (1 << 2),                        /* Scrap item type should not be saved*/
  61.     kScrapItemTypeSystemTranslated = (1 << 8)                    /* Scrap item type is translated by Scrap Manager*/
  62. };
  63.  
  64. /*
  65. _________________________________________________________________________________________________________
  66.  * FSOBJECTREF SCRAP ITEM TYPE
  67. _________________________________________________________________________________________________________
  68. */
  69.  
  70. enum {
  71.     kScrapItemTypeFSObject        = 'fsob'                        /* scrap item type for FSObjectRef data*/
  72. };
  73.  
  74. typedef struct FSObjectScrapItemType FSObjectScrapItemType;
  75. struct FSObjectScrapItemType {
  76.     FSObjectInformation             objectInfo_o;                /* FSObject information*/
  77.     FSObjectRef                     object_t;                    /* FSObjectRef - Call FSObjectRefRegister() before using*/
  78. };
  79.  
  80. /*
  81. _________________________________________________________________________________________________________
  82.     
  83.  * FSOBJECTREF PROMISE SCRAP ITEM TYPE
  84. _________________________________________________________________________________________________________
  85. */
  86.  
  87. enum {
  88.     kScrapItemTypePromiseFSObject = 'pfob'                        /* Scrap item type for promised FSObjectRef data*/
  89. };
  90.  
  91. typedef struct PromiseFSObjectScrapItemType PromiseFSObjectScrapItemType;
  92. struct PromiseFSObjectScrapItemType {
  93.     FSObjectInformation             objectInfo_o;                /* FSObject information*/
  94.     ScrapItemType                     promisedScrapItemType;        /* Promised scrap item type containing an FSObjectRef*/
  95. };
  96.  
  97. /*
  98. _________________________________________________________________________________________________________
  99.  * CREATING & DELETING SCRAPS
  100. _________________________________________________________________________________________________________
  101. */
  102. extern OSStatus NewScrapRef(ScrapRef *scrapReference);
  103.  
  104. extern OSStatus DisposeScrapRef(ScrapRef scrapReference);
  105.  
  106. /*
  107. _________________________________________________________________________________________________________
  108.  * ADDING SCRAP ITEMS
  109. _________________________________________________________________________________________________________
  110. */
  111. extern OSStatus AddScrapItemType(ScrapRef scrapReference, ScrapItemUserReference newOrExistingUserReference, ScrapItemType newItemType, void *data, ByteCount dataSize);
  112.  
  113. extern OSStatus SetScrapItemTypeData(ScrapRef scrapReference, ScrapItemUserReference existingUserReference, ScrapItemType existingItemType, const void *data, ByteCount dataSize, UInt32 dataOffset);
  114.  
  115. extern OSStatus SetScrapItemTypeAttributes(ScrapRef scrapReference, ScrapItemUserReference existingUserReference, ScrapItemType existingItemType, ScrapItemTypeAttributes attributes);
  116.  
  117. extern OSStatus SetScrapItemTypePromiseHint(ScrapRef scrapReference, ScrapItemUserReference existingUserReference, ScrapItemType existingItemType, UInt32 userPromiseHint);
  118.  
  119. /*
  120. _________________________________________________________________________________________________________
  121.  * GETTING SCRAP ITEM INFORMATION
  122.      NOTE: ALL INDEXES ARE 1 BASED (1 .. N)
  123. _________________________________________________________________________________________________________
  124. */
  125. extern OSStatus CountScrapItems(ScrapRef scrapReference, ItemCount *numberScrapItems);
  126.  
  127. extern OSStatus GetScrapItem(ScrapRef scrapReference, UInt32 scrapItemIndex, ScrapItemUserReference *userReference);
  128.  
  129. extern OSStatus CountScrapItemTypes(ScrapRef scrapReference, ScrapItemUserReference userReference, ItemCount *numberItemTypes);
  130.  
  131. extern OSStatus GetScrapItemType(ScrapRef scrapReference, ScrapItemUserReference userReference, UInt32 itemTypeIndex, ScrapItemType *itemType);
  132.  
  133. extern OSStatus GetScrapItemTypeDataSize(ScrapRef scrapReference, ScrapItemUserReference userReference, ScrapItemType itemType, ByteCount *itemTypeDataSize);
  134.  
  135. extern OSStatus GetScrapItemTypeData(ScrapRef scrapReference, ScrapItemUserReference userReference, ScrapItemType itemType, void *data, ByteCount *dataSize, UInt32 *dataOffset);
  136.  
  137. extern OSStatus GetScrapItemTypeAttributes(ScrapRef scrapReference, ScrapItemUserReference userReference, ScrapItemType itemType, ScrapItemTypeAttributes *attributes);
  138.  
  139. #endif
  140. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  141. /*
  142. _________________________________________________________________________________________________________
  143.  * CLASSIC SCRAP MANAGER API
  144. _________________________________________________________________________________________________________
  145. */
  146. struct ScrapStuff {
  147.     SInt32                             scrapSize;
  148.     Handle                             scrapHandle;
  149.     SInt16                             scrapCount;
  150.     SInt16                             scrapState;
  151.     StringPtr                         scrapName;
  152. };
  153. typedef struct ScrapStuff ScrapStuff;
  154.  
  155. typedef ScrapStuff *PScrapStuff;
  156. typedef ScrapStuff *ScrapStuffPtr;
  157. extern pascal ScrapStuffPtr InfoScrap(void )
  158.  ONEWORDINLINE(0xA9F9);
  159.  
  160. extern pascal SInt32 UnloadScrap(void )
  161.  ONEWORDINLINE(0xA9FA);
  162.  
  163. extern pascal SInt32 LoadScrap(void )
  164.  ONEWORDINLINE(0xA9FB);
  165.  
  166. extern pascal SInt32 GetScrap(Handle hDest, ResType theType, SInt32 *offset)
  167.  ONEWORDINLINE(0xA9FD);
  168.  
  169. extern pascal SInt32 ZeroScrap(void )
  170.  ONEWORDINLINE(0xA9FC);
  171.  
  172. extern pascal SInt32 PutScrap(SInt32 length, ResType theType, void *source)
  173.  ONEWORDINLINE(0xA9FE);
  174.  
  175. #endif
  176.  
  177. #if PRAGMA_ALIGN_SUPPORTED
  178. #pragma options align=reset
  179. #endif
  180.  
  181. #if PRAGMA_IMPORT_SUPPORTED
  182. #pragma import off
  183. #endif
  184.  
  185. #ifdef __cplusplus
  186. }
  187. #endif
  188.  
  189. #endif /* __SCRAP__ */
  190.  
  191.